package com.jxw.launcher.view;

import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.ImageView;
import com.jxw.launcher.R;
import com.shuyu.gsyvideoplayer.GSYVideoManager;
import com.shuyu.gsyvideoplayer.listener.GSYVideoProgressListener;
import com.shuyu.gsyvideoplayer.listener.VideoAllCallBack;
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer;

/* loaded from: classes.dex */
public class XdfVideoPlayer extends StandardGSYVideoPlayer {
    private static final int PLAY = 1000;
    private static final String TAG = "KnowVideoPlayer";
    private final Handler handler;
    private boolean isMute;
    private ImageView ivBg;
    private final VideoAllCallBack videoAllCallBack;
    private final GSYVideoProgressListener videoProgressListener;
    private String videoUrl;

    @Override // com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer, com.shuyu.gsyvideoplayer.video.base.GSYVideoView
    public int getLayoutId() {
        return R.layout.layout_xdf_video_player;
    }

    public XdfVideoPlayer(Context context, Boolean bool) {
        super(context, bool);
        this.handler = new Handler() { // from class: com.jxw.launcher.view.XdfVideoPlayer.1
            @Override // android.os.Handler
            public void handleMessage(Message message) {
                super.handleMessage(message);
                if (message.what == 1000) {
                    XdfVideoPlayer.this.play();
                }
            }
        };
        this.videoProgressListener = new GSYVideoProgressListener() { // from class: com.jxw.launcher.view.XdfVideoPlayer.2
            @Override // com.shuyu.gsyvideoplayer.listener.GSYVideoProgressListener
            public void onProgress(int i, int i2, int i3, int i4) {
                if (i > 0) {
                    XdfVideoPlayer.this.ivBg.setVisibility(8);
                }
            }
        };
        this.videoAllCallBack = new VideoAllCallBack() { // from class: com.jxw.launcher.view.XdfVideoPlayer.3
            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onAutoComplete(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickBlank(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickBlankFullscreen(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickResume(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickResumeFullscreen(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickSeekbar(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickSeekbarFullscreen(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickStartError(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickStartIcon(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickStartThumb(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickStop(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickStopFullscreen(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onEnterFullscreen(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onEnterSmallWidget(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onPlayError(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onQuitFullscreen(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onQuitSmallWidget(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onStartPrepared(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onTouchScreenSeekLight(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onTouchScreenSeekPosition(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onTouchScreenSeekVolume(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onPrepared(String str, Object... objArr) {
                XdfVideoPlayer.this.ivBg.setVisibility(8);
                XdfVideoPlayer xdfVideoPlayer = XdfVideoPlayer.this;
                xdfVideoPlayer.setMute(xdfVideoPlayer.isMute);
            }
        };
        init();
    }

    public XdfVideoPlayer(Context context) {
        super(context);
        this.handler = new Handler() { // from class: com.jxw.launcher.view.XdfVideoPlayer.1
            @Override // android.os.Handler
            public void handleMessage(Message message) {
                super.handleMessage(message);
                if (message.what == 1000) {
                    XdfVideoPlayer.this.play();
                }
            }
        };
        this.videoProgressListener = new GSYVideoProgressListener() { // from class: com.jxw.launcher.view.XdfVideoPlayer.2
            @Override // com.shuyu.gsyvideoplayer.listener.GSYVideoProgressListener
            public void onProgress(int i, int i2, int i3, int i4) {
                if (i > 0) {
                    XdfVideoPlayer.this.ivBg.setVisibility(8);
                }
            }
        };
        this.videoAllCallBack = new VideoAllCallBack() { // from class: com.jxw.launcher.view.XdfVideoPlayer.3
            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onAutoComplete(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickBlank(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickBlankFullscreen(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickResume(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickResumeFullscreen(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickSeekbar(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickSeekbarFullscreen(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickStartError(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickStartIcon(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickStartThumb(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickStop(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickStopFullscreen(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onEnterFullscreen(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onEnterSmallWidget(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onPlayError(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onQuitFullscreen(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onQuitSmallWidget(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onStartPrepared(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onTouchScreenSeekLight(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onTouchScreenSeekPosition(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onTouchScreenSeekVolume(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onPrepared(String str, Object... objArr) {
                XdfVideoPlayer.this.ivBg.setVisibility(8);
                XdfVideoPlayer xdfVideoPlayer = XdfVideoPlayer.this;
                xdfVideoPlayer.setMute(xdfVideoPlayer.isMute);
            }
        };
        init();
    }

    public XdfVideoPlayer(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        this.handler = new Handler() { // from class: com.jxw.launcher.view.XdfVideoPlayer.1
            @Override // android.os.Handler
            public void handleMessage(Message message) {
                super.handleMessage(message);
                if (message.what == 1000) {
                    XdfVideoPlayer.this.play();
                }
            }
        };
        this.videoProgressListener = new GSYVideoProgressListener() { // from class: com.jxw.launcher.view.XdfVideoPlayer.2
            @Override // com.shuyu.gsyvideoplayer.listener.GSYVideoProgressListener
            public void onProgress(int i, int i2, int i3, int i4) {
                if (i > 0) {
                    XdfVideoPlayer.this.ivBg.setVisibility(8);
                }
            }
        };
        this.videoAllCallBack = new VideoAllCallBack() { // from class: com.jxw.launcher.view.XdfVideoPlayer.3
            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onAutoComplete(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickBlank(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickBlankFullscreen(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickResume(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickResumeFullscreen(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickSeekbar(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickSeekbarFullscreen(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickStartError(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickStartIcon(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickStartThumb(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickStop(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onClickStopFullscreen(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onEnterFullscreen(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onEnterSmallWidget(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onPlayError(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onQuitFullscreen(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onQuitSmallWidget(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onStartPrepared(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onTouchScreenSeekLight(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onTouchScreenSeekPosition(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onTouchScreenSeekVolume(String str, Object... objArr) {
            }

            @Override // com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
            public void onPrepared(String str, Object... objArr) {
                XdfVideoPlayer.this.ivBg.setVisibility(8);
                XdfVideoPlayer xdfVideoPlayer = XdfVideoPlayer.this;
                xdfVideoPlayer.setMute(xdfVideoPlayer.isMute);
            }
        };
        init();
    }

    @Override // com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
    protected void updateStartImage() {
        ImageView imageView = (ImageView) this.mStartButton;
        if (this.mCurrentState == 2) {
            imageView.setImageResource(R.drawable.icon_bfz);
        } else {
            imageView.setImageResource(R.drawable.icon_ztz);
        }
    }

    public void start(String str) {
        this.videoUrl = str;
        new Thread(new Runnable() { // from class: com.jxw.launcher.view.-$$Lambda$XdfVideoPlayer$vd-95IFTJulNOSxt1IM77R8zw3E
            @Override // java.lang.Runnable
            public final void run() {
                XdfVideoPlayer.this.lambda$start$0$XdfVideoPlayer();
            }
        }).start();
    }

    public /* synthetic */ void lambda$start$0$XdfVideoPlayer() {
        Log.d(TAG, "start: videoUrl=" + this.videoUrl);
        this.handler.sendEmptyMessage(1000);
    }

    public void setMute(boolean z) {
        this.isMute = z;
        GSYVideoManager.instance().setNeedMute(z);
    }

    public void resume() {
        onVideoResume();
    }

    public void pause() {
        this.ivBg.setVisibility(0);
        onVideoPause();
    }

    @Override // com.shuyu.gsyvideoplayer.video.base.GSYVideoView
    public void release() {
        this.ivBg.setVisibility(0);
        setVideoAllCallBack(null);
        setGSYVideoProgressListener(null);
        GSYVideoManager.releaseAllVideos();
    }

    private void init() {
        this.ivBg = (ImageView) findViewById(R.id.iv_bg);
        setIsTouchWiget(false);
        setLooping(true);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public void play() {
        setVideoAllCallBack(this.videoAllCallBack);
        setGSYVideoProgressListener(this.videoProgressListener);
        setUp(this.videoUrl, true, null);
        startPlayLogic();
    }

    public void changeBackground(int i) {
        this.ivBg.setBackgroundResource(i);
    }
}
